<?php


namespace App\Remote\Feishu;

use App\Models\Common\ConfigModel;
use App\Remote\Remote;
use Closure;


class FeishuRemote extends Remote
{

    protected static array $instance = [];

    protected string $appId;
    protected string $appSecret;


    public function __construct()
    {
        $config          = ConfigModel::getFsConfigByPlatformNameOrgId("openShop", 0);
        $this->appId     = $config["appId"];
        $this->appSecret = $config["appSecret"];
    }


    /**
     * @return static
     */
    public static function getInstance(): self
    {
        if (!isset(self::$instance[static::class])) {
            self::$instance[static::class] = new static();
        }
        return self::$instance[static::class];
    }


    public static function getBaseUri(): string
    {
        // TODO: Implement getBaseUri() method.
        return "https://open.feishu.cn";
    }


    public static function registerResponseHandle(): Closure
    {
        return function (string $data) {
            return json_decode($data, true);
        };
        // TODO: Change the autogenerated stub
    }
}
